﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DocumentsTagger.DM;
using System.Collections.ObjectModel;

namespace DocumentsTagger.UI.ViewModel
{
    public class TagsDetailsViewModel : INotifyPropertyChanged
    {
        private readonly Tag r_Tag;
        private String m_TagName;
        private int m_AmountOfDocumentsLearnt;
        public String TagName
        {
            get { return m_TagName; }
            set { m_TagName = value; }
        }

        public int AmountOfDocumentsLearnt 
        {
            get
            {
                return m_AmountOfDocumentsLearnt;
            }
            set
            {
                m_AmountOfDocumentsLearnt = value;
            } 
        }

        public ObservableCollection<String> GoodWords
        {
            get { return new ObservableCollection<String>(r_Tag.GoodWords); }
            private set{}
        }
        

        
        
        public ObservableCollection<String> BadWords 
        {
            get { return new ObservableCollection<String>(r_Tag.BadWords); }
            private set{}
        }

        public TagsDetailsViewModel(Tag tag)
        {
            this.r_Tag = tag;
            this.m_TagName = tag.Name;
            this.AmountOfDocumentsLearnt = tag.DocumentsLearnt;
            this.BadWords = new ObservableCollection <String> (tag.BadWords);
            this.GoodWords = new ObservableCollection<String>(tag.GoodWords);
        }

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// initiated the notification process
        /// </summary>
        /// <param name="info"></param>
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    }
}
